package com.notes.algo.t8.dis;

import java.util.Scanner;

/**
 * @author
 * @Describe 功能描述
 * @date
 */
public class T3 {
    public static void main(String[] args) {
        int vexNum = 6;
        int edge = 8;

        // System.out.println("输入图的顶点个数和边的条数：");
        /*while (!check(vexNum, edge)) {
            System.out.println("输入的数值不合法，请重新输入");
        }*/
        Graph graph = new Graph(vexNum, edge);
        graph.createGraph();
        graph.print();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入开始节点：");
        int begin = sc.nextInt();
        graph.dis(begin);
        graph.printPath(begin);
        System.out.println("请输入结束节点：");
        int end = sc.nextInt();
        graph.printPath(begin, end);
    }

    public static boolean check(int vexNum, int edge) {
        if (vexNum <= 0 || edge <= 0 || ((vexNum * (vexNum - 1)) / 2) < edge) {
            return false;
        }
        return true;
    }
}
